Skip to content

Prompt file does not resolve #15

@arpan404

Description

@arpan404

What happened?

Even when absolute path is provided, the prompt resolvers is looking into .agents/prompt

What did you expect to happen?

It should have load the actual prompt file.

Minimal reproducible example

from afk.agents import Agent
from afk.core import Runner

agent = Agent(name="demo", model="ollama_chat/qwen3:8b", instruction_file="/Users/arpanbhandari/Code/orchy/prompts/instruction.txt")

runner = Runner()
result = runner.run_sync(agent, user_message="What is an error budget in SRE?")
print(result.final_text)
print(result.state)

Traceback or logs

uv run main.py
Traceback (most recent call last):
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/llms/utils.py", line 202, in run_sync
    asyncio.get_running_loop()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
RuntimeError: no running event loop

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/arpanbhandari/Code/orchy/main.py", line 8, in <module>
    result = runner.run_sync(agent, user_message="What is an error budget in SRE?")
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/core/runner/api.py", line 334, in run_sync
    return _run_sync(
        self.run(
    ...<4 lines>...
        )
    )
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/llms/utils.py", line 210, in run_sync
    return asyncio.run(coro)
           ~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/core/runner/api.py", line 299, in run
    result = await handle.await_result()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/core/runner/types.py", line 259, in await_result
    return await self._result_fut
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/core/runner/execution.py", line 361, in _execute
    base_inst = await agent.resolve_instructions(ctx)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/agents/core/base.py", line 204, in resolve_instructions
    prompt_path = resolve_prompt_file_path(
        prompt_root=prompt_root,
        instruction_file=self.instruction_file,
        agent_name=self.name,
    )
  File "/Users/arpanbhandari/Code/orchy/.venv/lib/python3.13/site-packages/afk/agents/prompts/store.py", line 116, in resolve_prompt_file_path
    raise PromptAccessError(
    ...<2 lines>...
    )
afk.agents.errors.PromptAccessError: instruction_file path escapes configured prompts root (path='/Users/arpanbhandari/Code/orchy/prompts/instruction.txt', root='/Users/arpanbhandari/Code/orchy/.agents/prompt')

Impacted area

Core Runner lifecycle

Execution mode

run_sync (sync CLI)

Relevant configuration

OS

macOS

Python version

3.13

AFK SDK version

0.1.0

LLM provider/model (if applicable)

ollama_chat/qwen3:8b

Checklist

  • I searched existing issues and did not find a duplicate.
  • I can reproduce this on the latest main branch.
  • I included a minimal repro and environment details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions