mycode-sdk 0.5.1__tar.gz → 0.5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mycode-sdk
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: Multi-turn tool-calling agent runtime for embedding the mycode agent loop.
5
5
  Project-URL: Homepage, https://github.com/legibet/mycode
6
6
  Project-URL: Repository, https://github.com/legibet/mycode
@@ -47,7 +47,6 @@ async def main() -> None:
47
47
  agent = Agent(
48
48
  model="claude-sonnet-4-6",
49
49
  api_key="YOUR_API_KEY",
50
- cwd=".",
51
50
  tools=[read_tool, bash_tool],
52
51
  )
53
52
 
@@ -59,7 +58,7 @@ async def main() -> None:
59
58
  asyncio.run(main())
60
59
  ```
61
60
 
62
- `Agent(...)` infers the provider from the model id. No tools are registered unless you pass `tools=[...]`, and nothing is persisted unless you pass `session_dir=`.
61
+ `Agent(...)` infers the provider from the model id and defaults `cwd` to the current working directory. No tools are registered unless you pass `tools=[...]`, and nothing is persisted unless you pass `session_dir=`.
63
62
 
64
63
  For a synchronous call, use `run()` — it collects the stream into a `RunResult`:
65
64
 
@@ -101,7 +100,6 @@ def summarize_file(ctx: ToolContext, path: str) -> str:
101
100
  agent = Agent(
102
101
  model="claude-sonnet-4-6",
103
102
  api_key="YOUR_API_KEY",
104
- cwd=".",
105
103
  tools=[read_tool, summarize_file],
106
104
  )
107
105
  ```
@@ -22,7 +22,6 @@ async def main() -> None:
22
22
  agent = Agent(
23
23
  model="claude-sonnet-4-6",
24
24
  api_key="YOUR_API_KEY",
25
- cwd=".",
26
25
  tools=[read_tool, bash_tool],
27
26
  )
28
27
 
@@ -34,7 +33,7 @@ async def main() -> None:
34
33
  asyncio.run(main())
35
34
  ```
36
35
 
37
- `Agent(...)` infers the provider from the model id. No tools are registered unless you pass `tools=[...]`, and nothing is persisted unless you pass `session_dir=`.
36
+ `Agent(...)` infers the provider from the model id and defaults `cwd` to the current working directory. No tools are registered unless you pass `tools=[...]`, and nothing is persisted unless you pass `session_dir=`.
38
37
 
39
38
  For a synchronous call, use `run()` — it collects the stream into a `RunResult`:
40
39
 
@@ -76,7 +75,6 @@ def summarize_file(ctx: ToolContext, path: str) -> str:
76
75
  agent = Agent(
77
76
  model="claude-sonnet-4-6",
78
77
  api_key="YOUR_API_KEY",
79
- cwd=".",
80
78
  tools=[read_tool, summarize_file],
81
79
  )
82
80
  ```
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mycode-sdk"
7
- version = "0.5.1"
7
+ version = "0.5.2"
8
8
  description = "Multi-turn tool-calling agent runtime for embedding the mycode agent loop."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -9,6 +9,7 @@ from __future__ import annotations
9
9
 
10
10
  import asyncio
11
11
  import logging
12
+ import os
12
13
  import tempfile
13
14
  from collections.abc import AsyncIterator, Awaitable, Callable, Sequence
14
15
  from dataclasses import dataclass, field
@@ -65,7 +66,7 @@ class Agent:
65
66
  self,
66
67
  *,
67
68
  model: str,
68
- cwd: str,
69
+ cwd: str | None = None,
69
70
  provider: str | None = None,
70
71
  session_dir: Path | None = None,
71
72
  session_id: str | None = None,
@@ -91,7 +92,8 @@ class Agent:
91
92
  provider = inferred
92
93
  self.provider = provider
93
94
 
94
- self.cwd = str(Path(cwd).resolve(strict=False))
95
+ resolved_cwd = cwd if cwd is not None else os.getcwd()
96
+ self.cwd = str(Path(resolved_cwd).resolve(strict=False))
95
97
 
96
98
  # Persistence is opt-in: a store is only created when ``session_dir``
97
99
  # is supplied. ``session_id`` is always populated (uuid when absent)
File without changes
File without changes