add thread id property
This commit is contained in:
@@ -57,9 +57,6 @@ def main():
|
|||||||
"darinkishore/codex-agent",
|
"darinkishore/codex-agent",
|
||||||
config_options={
|
config_options={
|
||||||
"signature": sig,
|
"signature": sig,
|
||||||
"working_directory": ".",
|
|
||||||
"model": "gpt-4o",
|
|
||||||
"codex_path_override": "/opt/homebrew/bin/codex" # Optional: customize codex binary path
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"signature": "message:str -> answer:str",
|
"signature": "message:str -> answer:str",
|
||||||
"working_directory": "",
|
"working_directory": ".",
|
||||||
"model": null,
|
"model": "gpt-4o",
|
||||||
"sandbox_mode": null,
|
"sandbox_mode": null,
|
||||||
"skip_git_repo_check": false,
|
"skip_git_repo_check": false,
|
||||||
"api_key": null,
|
"api_key": null,
|
||||||
"base_url": null,
|
"base_url": null,
|
||||||
"codex_path_override": null
|
"codex_path_override": "/opt/homebrew/bin/codex"
|
||||||
}
|
}
|
||||||
2
main.py
2
main.py
@@ -7,7 +7,7 @@ codex_agent = CodexAgent(CodexAgentConfig())
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
codex_agent.push_to_hub("darinkishore/codex-agent", with_code=True, commit_message="update README.md")
|
codex_agent.push_to_hub("darinkishore/codex-agent", with_code=True, commit_message="add thread id property")
|
||||||
#result = codex_agent(message="What files are in this directory?")
|
#result = codex_agent(message="What files are in this directory?")
|
||||||
#print(result.answer) # String response
|
#print(result.answer) # String response
|
||||||
#print(result.trace) # Execution items (commands, files, etc.)
|
#print(result.trace) # Execution items (commands, files, etc.)
|
||||||
|
|||||||
18
src/index.py
18
src/index.py
@@ -8,13 +8,13 @@ from typing import Optional
|
|||||||
|
|
||||||
class CodexAgentConfig(PrecompiledConfig):
|
class CodexAgentConfig(PrecompiledConfig):
|
||||||
signature: str | type[Signature] = "message:str -> answer:str"
|
signature: str | type[Signature] = "message:str -> answer:str"
|
||||||
working_directory: str = ""
|
working_directory: str = "."
|
||||||
model: Optional[str] = None
|
model: Optional[str] = "gpt-4o"
|
||||||
sandbox_mode: Optional[SandboxMode] = None
|
sandbox_mode: Optional[SandboxMode] = None
|
||||||
skip_git_repo_check: bool = False
|
skip_git_repo_check: bool = False
|
||||||
api_key: Optional[str] = None
|
api_key: Optional[str] = None
|
||||||
base_url: Optional[str] = None
|
base_url: Optional[str] = None
|
||||||
codex_path_override: Optional[str] = None
|
codex_path_override: Optional[str] = "/opt/homebrew/bin/codex"
|
||||||
|
|
||||||
class CodexAgent(PrecompiledAgent):
|
class CodexAgent(PrecompiledAgent):
|
||||||
config : CodexAgentConfig
|
config : CodexAgentConfig
|
||||||
@@ -35,3 +35,15 @@ class CodexAgent(PrecompiledAgent):
|
|||||||
|
|
||||||
def forward(self, **kwargs) -> Prediction:
|
def forward(self, **kwargs) -> Prediction:
|
||||||
return self.codex_module(**kwargs)
|
return self.codex_module(**kwargs)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thread_id(self) -> Optional[str]:
|
||||||
|
"""Get thread ID for this agent instance.
|
||||||
|
|
||||||
|
The thread ID is assigned after the first forward() call.
|
||||||
|
Useful for debugging and visibility into the conversation state.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Thread ID string, or None if no forward() calls have been made yet
|
||||||
|
"""
|
||||||
|
return self.codex_module.thread.id
|
||||||
Reference in New Issue
Block a user